﻿<%@ Page Language="C#" %>

<script runat="server">
  [System.Web.Services.WebMethod]
  public static string LoginInfo()
  {
      string strJSon = "";
      string strUserID = "";
      string strMemberID = "";
      string strAuthType = "";
      if (!string.IsNullOrEmpty(HttpContext.Current.User.Identity.Name)) 
      {
          strUserID = HttpContext.Current.User.Identity.Name;          
          if (HttpContext.Current.Request.Cookies["LoginInfo"] != null)
          {
              HttpCookie LoginInfo = HttpContext.Current.Request.Cookies["LoginInfo"] as HttpCookie;
              strAuthType = LoginInfo.Values["AuthType"].ToString();
              strMemberID = LoginInfo.Values["MemberID"].ToString();
          }
          //JObject物件
          JObject objJSon = new JObject(
               new JProperty("UserID", strUserID),
               new JProperty("AuthType", strAuthType),
               new JProperty("MemberID", strMemberID));
          strJSon = objJSon.ToString();
          JObject restoredObject = JsonConvert.DeserializeObject<JObject>(strJSon);
      }
      return strJSon;
  }
</script>